package org.ns.tomdog.classloader;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class CommonClassLoader extends LocalClassLoader{

    public CommonClassLoader(ClassPath classpath) {
        this(classpath, new ConcurrentHashMap<>());
    }
    public CommonClassLoader(ClassPath classpath, Map<String, Class<?>> classMap) {
        super(classpath, classMap);
    }

    @Override
    protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
        try {
            Class beanClass = getParent().loadClass(name);
            if (beanClass != null) {
                return beanClass;
            }
        } catch (ClassNotFoundException e) {

        }
        return super.loadClass(name, resolve);
    }


}
